file (GLOB_RECURSE SRC_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp ${CMAKE_CURRENT_SOURCE_DIR}/*.cc)
include_directories(.)
add_library(xplatform  SHARED ${SRC_FILES})

target_link_libraries(xplatform PRIVATE event protobuf protoc XSSL event_openssl)
if(WIN32)
  target_link_libraries(xplatform PRIVATE ws2_32)
endif()
set_out_path(xplatform)
set_runtime_name(xplatform)
# 在构建 my_executable 之前执行一个自定义命令
add_custom_command(
    TARGET xplatform PRE_BUILD
    COMMAND protoc -I/home/huxiaoyun/xcom/src/xplatform/protobuf/ xmsg_com.proto xmsg_type.proto --cpp_out=/home/huxiaoyun/xcom/src/xplatform/protobuf/
)
# 设置安装路径
install(TARGETS xplatform
    ARCHIVE DESTINATION lib
    LIBRARY DESTINATION lib
    RUNTIME DESTINATION bin
)
# 安装头文件
file(GLOB_RECURSE INCLUDE_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*.h)
install(FILES ${INCLUDE_FILES}
    DESTINATION include/xcom/xplatform
)